package com.armani.service.impl;

import com.armani.entity.ItemSpu;
import com.armani.mapper.SpuMapper;
import com.armani.service.SpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.beans.Transient;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SpuServiceImpl
 * @Description TODO
 * @Author Admin
 * @Date 2021/11/27 9:16
 * @Version 1.0
 **/
@Service
public class SpuServiceImpl implements SpuService {
    @Autowired
    private SpuMapper spuMapper;
    @Override
    public List<ItemSpu> pageSearch(Integer startRow, Integer limit, Integer id) {
        return spuMapper.pageSearch(startRow,limit,id);
    }
    @Override
    public Integer getCount(Integer id) {
        return spuMapper.getCount(id);
    }

    @Override
    @Transient
    public Integer insert(String name,String subName, Integer typeId1, Integer typeId2,String method, Integer saleAble, Date createTime, Date lastTime) {
        return spuMapper.insert(name, subName,typeId1, typeId2,method, saleAble, createTime, lastTime);
    }

    @Override
    @Transient
    public Integer update(Integer id, String name,String subName, Integer typeId1, Integer typeId2,String method, Integer saleAble, Date createTime, Date lastTime) {
        return spuMapper.update(id, name, subName,typeId1, typeId2,method, saleAble, createTime, lastTime);
    }

    @Override
    @Transient
    public Integer delete(Integer id) {
        return spuMapper.delete(id);
    }

    /**
     * 根据id更新saleAble
     *
     * @param params 参数（id，saleAble）
     * @return 影响行
     */
    @Override
    public Integer isSaleAble(Map<String, Object> params) {
        return spuMapper.isSaleAble(params);
    }
}
